#include "tcpserver.hpp"
#include "log.hpp"
#include <memory>

extern Log lg;

void Usage(const std::string &proc)
{
    std::cout << "\n\tUsage: " << proc << " port[1024+]\n"
         << std::endl;
}

int main(int argc, char *argv[])
{
    if (argc != 2)
    {
        Usage(argv[0]);
        exit(-1);
    }

    lg.Enable(Classfile); // 分文件打印
    uint16_t port = std::stoi(argv[1]);

    std::unique_ptr<TcpServer> tcp(new TcpServer(port));

    tcp->Init();
    tcp->run();

    return 0;
}